package core.basic.dao.query;

import org.hibernate.Query;

public class ParameterString extends AbstractParameter<String> {

    private boolean isLike;

    public boolean isLike() {
        return isLike;
    }

    public void setLike(boolean like) {
        isLike = like;
    }

    public ParameterString(String name, String value) {
        super(name, value);
    }

    public void setParameterValue(Query q) {
        if (isLike) {
            q.setString(getName(), "%" + getValue() + "%");
        } else {
            q.setString(getName(), getValue());
        }
    }
}
